from math import *

def get_distance_to(a, p):
    """Returns the distance to a point.

    @param: A Vector2 or list-like object with at least 2 values.
    @return: distance
    """
    x, y = a
    xx, yy = p
    dx = xx-x
    dy = yy-y
    return sqrt( dx*dx + dy*dy )

def normalize(a):
        """Normalises this vector."""
        a = a
        x, y = a
        l = sqrt(x*x +y*y)
        try:
            x /= l
            y /= l
        except ZeroDivisionError:
            x = 0.
            y = 0.
        return (x,y)

def get_angle_to(center,other):
        xs = other[0] - center[0]
        ys = other[1] - center[1]
        theta = atan2(ys,xs)
        deg = degrees(theta)
        if deg < 0:
            deg += 360
        return deg 